<template>
  <div class="app-container">
    <u-page title="负库存开关">
      <el-input
        v-model="dataForm.textarea"
        type="textarea"
        :rows="2"
        placeholder="请输入6位商品代码，多个请用逗号分开"
      />
      <el-button type="primary" @click="setOpen()">打开负库存</el-button>
      <el-button type="warning" @click="setClose()">关闭负库存</el-button>
    </u-page>
  </div>
</template>

<script>
export default {
  data() {
    return {
      api: this.$u.api.ShangyouGoods,
      dataForm: {
        textarea: '',
        status: ''
      }
    }
  },
  methods: {
    setOpen() {
      this.dataForm.status = '2'
      this.api.switchStock(this.dataForm).then(res => {
        this.$u.msg('操作成功')
      })
    },
    setClose() {
      this.dataForm.status = '0'
      this.api.switchStock(this.dataForm).then(res => {
        this.$u.msg('操作成功')
      })
    }
  }
}
</script>

<style scoped>

</style>
